<div id="user_data_page" class="in_page">
    <div class="panel panel-default" style="margin: 0px;padding: 0px;">
        <div class="panel-body" style="padding:0px; padding-left: 10px;padding-top: 10px;">
            <form class="form-inline">
                <div class="form-group" style="width: 260px;display: inline-block;padding-bottom: 0px;">
                    <label for="exampleInputName2">用户名</label>
                    <input style="display: inline-block;width: 200px;" name="username" value="{$username}" type="text" name="username" class="form-control"  placeholder="输入用户名" />
                    <input value="1" type="hidden" name="p" class="form-control" />
                    <input value="{$ids}" type="hidden" name="ids" class="form-control" />
                    <input value="{$type}" type="hidden" name="type" class="form-control" />

                </div>
                <button style="display: inline-block;" type="submit" class="btn btn-sm btn-default">搜索</button>
                <div style="display: inline-block;" class="btn-group">
                    <button type="reset" class="btn btn-sm btn-primary">重置</button>
                </div>
            </form>
        </div>
    </div>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th style="width: 60px; text-align: center"></th>
            <th>用户名</th>
            <th>总余额</th>
            <th>剩余余额</th>
        </tr>
        </thead>
        <volist name="list" id="item">
        <tr>
            <td style="width: 60px; text-align: center"><input onchange="selectUser(this)" class="user-checkBox" type="checkbox" balance="{$item.balance}" username="{$item.username}" value="{$item.user_id}" /></td>
            <td>{$item.username}</td>
            <td>{$item.total_balance}</td>
            <td><span style="color: green">{$item.balance}</span></td>
        </tr>
        </volist>
    </table>
    <div style="margin-bottom: 50px;">{$page}</div>
    <br />
    <br />
    <br />
    <div class="layer_btn_panel">
        <button onclick="select(this)" class="btn btn-sm btn-success" >确认选择</button>
        <input class="btn btn-sm" onclick="closeIframe()" type="button" value="取消" />
    </div>
</div>

<script>
    function selectUser(_this){
        if($(_this).is(':checked')){
            $("#user_data_page").find(".check-true").removeAttr("checked").removeClass("check-true");
            $(_this).addClass("check-true");
        }else{
            $(_this).removeClass("check-true");
        }
    }

    function select(_this){
        if($(".check-true").length==0){
            alert("请选择一个用户");
            return false;
        }
        var  data={};
        data.username=$(".check-true").attr("username");
        data.user_id=$(".check-true").val();
        data.balance=$(".check-true").attr("balance");
        window.parent.handleUser(data);
        closeIframe();
    }
</script>